var speed = 6.0;
var rotateSpeed = 3.0;
var faux = Vector3.zero; //gravity value
var ground = 0;

private var moveDirection = Vector3.zero;
private var targetPos = Vector3.zero;

function OnDrawGizmos () {
Gizmos.DrawIcon (transform.position + (-transform.up * 1.5), "");
}

function FixedUpdate()
{
    var controller : CharacterController = GetComponent(CharacterController);

    // You don't need to transform Vector3.up here; you can just use
    // -transform.up.
    var targetDir = transform.TransformDirection (-Vector3.up);
    
    if (!Physics.Raycast (transform.position,-transform.up, 1.5))
    {
        ground = 0;
        faux +=(transform.position - Vector3.zero).normalized * -2 *Time.deltaTime; //apply gravity
        controller.Move(faux);

    }
    else
    {
		ground = 1;
        faux = Vector3.zero; // reset gravity
    }
	print ("Ground = " + ground);
   // Here you're overwriting the current orientation (as you noted in
   // your post). Instead, you want to apply a corrective rotation,
   // something like (note that subtracting Vector3.zero isn't
   // needed):
   QuaternionRotation = Quaternion.FromToRotation(transform.up, (transform.position - Vector3.zero).normalized);
    transform.rotation = QuaternionRotation * transform.rotation;
    /*
    transform.rotation = Quaternion.FromToRotation (
        Vector3.up,
        (transform.position - Vector3.zero).normalized
    );
    */
 
    // These lines can be combined into
    // 'moveDirection =
    //     transform.forward * Input.GetAxis("Vertical") * speed'.
    moveDirection = Vector3(0 ,0 , Input.GetAxis("Vertical"));
    moveDirection = transform.TransformDirection(moveDirection);
    moveDirection *= speed;

    // Now that you're not overwriting the orientation every update,
    // this should work.
    transform.Rotate(0, Input.GetAxis ("Horizontal") * rotateSpeed, 0);
 
    controller.Move((moveDirection) * Time.deltaTime);

}